@extends("admin.layout.main")
@section("content")
    <div class="tpl-content-wrapper">
        <div class="tpl-content-page-title">
            管理员管理
        </div>
        <ol class="am-breadcrumb">
            <li><a href="#" class="am-icon-home">首页</a></li>
            <li><a href="#">系统管理</a></li>
            <li class="am-active">管理员管理</li>
        </ol>
        <div class="tpl-portlet-components">
            <div class="portlet-title">
                <div class="caption font-green bold">
                    <span class="am-icon-code"></span> 角色列表
                </div>
            </div>

            <div class="tpl-block ">
                <div class="am-g tpl-amazeui-form">
                    <div class="am-u-sm-12 am-u-md-9">
                        <form class="am-form am-form-horizontal" method="post" action="/admin/users/{{$user->id}}/role">
                            {{csrf_field()}}
                            @foreach($roles as $role)
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label"></label>
                                <div class="am-u-sm-9">
                                    <div class="am-checkbox">
                                        <label>
                                            <input name="roles[]" type="checkbox"
                                                   @if ($myRoles->contains($role))
                                                   checked
                                                    @endif
                                                   value="{{$role->id}}"> {{$role->name}}
                                        </label>
                                    </div>
                                </div>
                            </div>
                            @endforeach

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3">
                                    <button type="submit" class="am-btn am-btn-primary">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        @include("admin.layout.error")
    </div>
@endsection